/**
    [Filename]
    Purpose: [Purpose]

    @author Jason Wojcik
    @version [version]
*/

#include "CApp.h"

//handle events
void CApp::OnEvent(SDL_Event* Event){
    CEvent::OnEvent(Event);
}

//handle exit
void CApp::OnExit(){
    Running = false;
}

//perform on key down
void CApp::OnKeyDown(SDLKey sym, SDLMod mod, Uint16 unicode) {

    switch(sym) {
        //LEFT - move player left
        case SDLK_LEFT: {
            chips[turn].MoveLeft = true;
            chips[turn].IsKeyUp = false;
            break;
        }

        //RIGHT - move player right
        case SDLK_RIGHT: {
            chips[turn].MoveRight = true;
            chips[turn].IsKeyUp = false;
            break;
        }

        //press enter to drop the chip
        case SDLK_RETURN: {
            chips[turn].Flags = ENTITY_FLAG_GRAVITY;
            arrow.RenderOn = false;

            break;
        }

        //press R to reset the game board
        case SDLK_r: {
            C4Init();
            break;
        }

        default: {
        }
    }

 /* YOSHI
    switch(sym) {
        //LEFT - move player left
        case SDLK_LEFT: {
            Player.MoveLeft = true;
            break;
        }

        //RIGHT - move player right
        case SDLK_RIGHT: {
            Player.MoveRight = true;
            break;
        }

        //SPACE - make player jump
        case SDLK_SPACE: {
            Player.Jump();
            break;
        }

        default: {
        }
    }
    */
}

//perform on key up
void CApp::OnKeyUp(SDLKey sym, SDLMod mod, Uint16 unicode) {

    switch(sym) {
        case SDLK_LEFT: {
            chips[turn].MoveLeft = false;
            break;
        }

        case SDLK_RIGHT: {
            chips[turn].MoveRight = false;
            break;
        }

        default: {
        }
    }


    /* YOSHI
    switch(sym) {
        case SDLK_LEFT: {
            Player.MoveLeft = false;
            break;
        }

        case SDLK_RIGHT: {
            Player.MoveRight = false;
            break;
        }

        default: {
        }
    }
    */
}
